var chartDom = document.getElementById('fenshaochangzaijianshuliang');
var myChart = echarts.init(chartDom, 'dark');
var option;

option = {
     graphic: [
        {
           type:"image",
           left:"5%",
           bottom:"91.5%",
           style: {
               image:"https://i.loli.net/2021/06/21/CvlGW8PErboK2YQ.png",
               width:"68",
               height:"45",
            }
         },
         ],
 backgroundColor: 'rgba(0,21,46)',
    title: {
        text: '超过5成省份，垃圾焚烧厂规划建设数量少于在建数量',
        left:'12%',
        top: '3%',
        textStyle: {
            fontSize:20,
            color:"#FFFFFF",
            fontFamily: "Microsoft YaHei",
               },
    },
    legend: {
        bottom: 10,
        data: ['2018-2020年在建数量','2021年-2030年规划数量'],
        itemGap: 60,
        textStyle: {
            color: '#fff',
            fontSize: 14
        },
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        left: '10%',
        right: '10%',
        bottom: '10%',
        top: '20%',
        containLabel: true
    },
    xAxis: [
        {
            type: 'value'
        }
    ],
    yAxis: [
        {
            type: 'category',
            axisTick: {
                show: false
            },
            data: ['青海','湖南','陕西','河北','福建','河南', '江苏','安徽',"天津","新疆", "贵州" ,'广西', '云南',"四川",'海南'],
        }
    ],

    series: [
        {
            name: '2021年-2030年规划数量',
            type: 'bar',
            itemStyle: {
            color: new echarts.graphic.LinearGradient( 1, 0, 0, 0,[
                { offset: 0, color: 'rgba(166,107,86)' },
                { offset: 1, color: 'rgba(242,146,104)' }
                                           ])
        },
            barWidth:"18",
            stack: '总量',
            label: {
                show: true,
                position: 'right',
            },
            emphasis: {
                focus: 'series'
            },
            data: [2,10,11,20, 21, 22, 27,30,9,10,24,30,32,32,32],
            markArea: {
                itemStyle: {
                    color: 'rgba(255, 173, 177, 0.4)'
                },
                data: [ [{
                    yAxis: '安徽'
                }, {
                    xAxis: '青海'
                }], ]
            }
        },
        {
            name: '2018-2020年在建数量',
            type: 'bar',
            stack: '总量',
                        itemStyle: {
        color:  new echarts.graphic.LinearGradient( 1, 0, 0, 0,[
                { offset: 0, color: 'rgba(136,226,226)' },
                { offset: 1, color: 'rgba(79,140,150)' }
                                           ])
        },
            label: {
                show: false,
                position: 'left'
            },
            emphasis: {
                focus: 'series'
            },
            data: [-3,-22,-25,-65,-27, -53, -39,-35,-6,-7,-6,-28,-14,-30,-9]
        }
    ]
};

option && myChart.setOption(option);
